"""
用户中心首页
"""
from selenium.webdriver.common.by import By
from selenium import webdriver
from page.base_page import BasePage
class UserCenter(BasePage):
    # def __init__(self,driver):
    #     self.driver=driver
    user_informatin_btn_locator=(By.CSS_SELECTOR,"body > div.block.clearfix > div.AreaL > div > div > div > div > a:nth-child(2)")
    user_order_btn_locator=(By.CSS_SELECTOR,"body > div.block.clearfix > div.AreaL > div > div > div > div > a:nth-child(3)")
    user_address_btn_locator=(By.CSS_SELECTOR,"body > div.block.clearfix > div.AreaL > div > div > div > div >a:nth-child(4)")
    user_colletion_btn_locator=(By.CSS_SELECTOR,"body > div.block.clearfix > div.AreaL > div > div > div > div > a:nth-child(5)")
    user_message_btn_locator = (By.CSS_SELECTOR, "body > div.block.clearfix > div.AreaL > div > div > div > div > a:nth-child(6)")
    # 找到搜索输入框元素
    ele_search_locator = (By.ID, 'keyword')
    # 找到搜索按钮
    ele_search_btn_locator = (By.NAME, 'imageField')
    # 找到点击商品图片
    ele_goods_img_locator = (By.LINK_TEXT, '高质感毛呢大衣')

    def userinformation(self):
        self.driver.find_element(*self.user_informatin_btn_locator).click()
    def userorder(self):
        self.driver.find_element(*self.user_order_btn_locator).click()
    def useraddress(self):
        self.driver.find_element(*self.user_address_btn_locator).click()
    def usercollection(self):
        self.driver.find_element(*self.user_colletion_btn_locator).click()
    def usermessage(self):
        self.driver.find_element(*self.user_message_btn_locator).click()
    def input_goods(self):
        self.driver.find_element(*self.ele_search_locator).send_keys('大衣')
    def search_btn(self):
        self.driver.find_element(*self.ele_search_btn_locator).click()
    def goods_img(self):
        self.driver.find_element(*self.ele_goods_img_locator).click()
    def search_goods(self):
        self.input_goods()
        self.search_btn()
        self.goods_img()




